<template>
  <div class="page">
    {{name}}
    <button @click="dispatch">通知祖先元素</button>
    <button @click="evBus">分发bus</button>
  </div>
</template>

<script type="text/ecmascript-6">
export default {
  data() {
    return {
      i: 1
    };
  },
  inject:['name'],
  components: {},
  methods: {
    dispatch() {
      this.i++;
      this.$dispatch("dispatch", this.i+"我是来自孙子组件的");
    },
    evBus(){
      this.$bus.$emit('ev-bus','分发来的bus信息')
    }
  },
  mounted() {
  }
};
</script>

<style scoped></style>
